package com.xxc.example.controller;

import com.xxc.response.anotation.OriginResponse;
import com.xxc.response.anotation.ResponseResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试通用返回的controller
 * 由于添加了Logger的依赖，请求的方法会自动打印参数和响应日志 {@link com.xxc.logger.handler.LoggerAspect}
 * 只需给Controller以@RestController以及@ResponseResult注解就可以将响应包裹在{@link ResponseResult}中设置的Result类中
 * @author xxc、
 */
@RestController
@ResponseResult
@RequestMapping("/rest")
public class CommonResponseController {

    @RequestMapping("/hello")
    public String hello() {
        return "hello";
    }

    /**
     * 添加 {@link OriginResponse}注解后，此响应将不再转换为Result
     * @return
     */
    @RequestMapping("/originResponse")
    @OriginResponse
    public String originResponse () {
        return "originResponse";
    }
}
